s1 = 'HelloWorld'

print(s1.lower())
print(s1.upper())
print(s1.title())

print(s1.count('l'))
print(s1.find('l'))
print(s1.find('p'))

print(s1.index('l'))
# print(s1.index('p')) #报错

print(s1.endswith('d'))
print(s1.startswith('h'))


s2=s1.replace('o','你好', 1)
print(s2)

# 字符串在指定宽度居中
print(s1.center(20))
print(s1.center(20,'x'))

s3 = '  hello  '
print(s3.strip())

s4 = 'dl-hello-world'
print(s4.strip('ld')) #与ld顺序无关
print(s4.lstrip('ld'))
print(s4.rstrip('ld'))
